package main

import (
	"fmt"
	"git.oschina.net/OO-o/stock/root/sina"
	"git.oschina.net/OO-o/stock/root/wangyi163"
	"stocks/fn/Data"
	"sync"
)

func main() {
	Do(20)
}
func Do(CpuNub int) {
	var wait sync.WaitGroup
	Codes := Data.Returncode()
	c := make(chan string)
	wait.Add(CpuNub)
	for i := 0; i < CpuNub; i++ {
		go func() {
			for item := range c {
				info := wangyi163.Do(item)
				if len(info) >= 1 {
					info := sina.Do(info[0].Code, "60", 3)
					if len(info) > 0 {
						fmt.Println(info)
					}

				}
			}
			wait.Done()
		}()
	}
	for i := 0; i < len(Codes); i++ {
		c <- Codes[i]
	}
	close(c)
	wait.Wait()
}
